package 软件工程实验三.A1.A14;

import 软件工程实验三.A1.A11.DateUtils;
import 软件工程实验三.A1.A14.pay.*;

import java.text.ParseException;

public class Client {
    public static void main(String[] args) throws ParseException {
        // 创建客户
        Customer customer = new Customer("张三", "13800000000", "北京市海淀区中关村大街2号", true);
        Customer customer1 = new Customer("李四", "13800000001", "北京市海淀区中关村大街3号", true);
        // 创建支付方式
        Credit credit = new Credit("6227950000000000", "VISA", null);
        WireTransfer wireTransfer = new WireTransfer(123456789, "中国农业银行");
        AliPay aliPay = new AliPay(2345678);
        WeixinPay weixinPay = new WeixinPay(345678);
        Cash cash = new Cash(345678.6f);

        // 创建商品
        Product product1 = new Product("iPhone XS Max", 12, "Apple iPhone XS Max (A2123)",10000f);
        Product product2 = new Product("iPhone 11 Pro Max", 13, "Apple iPhone 11 Pro Max (A2217)",15000f);
        Product product3 = new Product("Samsung Galaxy S10+", 10, "Samsung Galaxy S10+ (SM-G975F)",5000f);
        Product product4 = new Product("Huawei P30 Pro", 9, "Huawei P30 Pro (VOG-L29)",7000f);

        // 创建订单详情
        OrderDetail orderDetail = new OrderDetail();
        orderDetail.addProduct(product1);
        orderDetail.addProduct(product2);
        orderDetail.addProduct(product3);
        orderDetail.addProduct(product4);

        // 创建订单
        Order order = new Order(DateUtils.parseDate("2022-01-01"));
        order.setTheOrderDetail(orderDetail);

        // 将订单关联到客户
        order.checkout(credit);
        order.delivery(customer);

        System.out.println("-----------------------------");
        //第二个测试
        orderDetail.removeProduct(product1);
        order.checkout(weixinPay);
        order.delivery(customer1);
    }
}
